package com.crossriver.crgis.cofo.util;

import java.util.HashMap;

public class WebPayResponceCode {

	//public static WebPayResponceCode instance = new WebPayResponceCode();
	
	private static HashMap<String, String> responses = new HashMap<String, String>();
	
	private static void buildResponses(){
		
		String[] respAndCodes = {
				
			"00: Approved by Financial Institution",
			"01: Refer to Financial Institution",
			"02: Refer to Financial Institution, Special Condition",
			"03: Invalid Merchant",
			"04: Pick-up card",
			"05: Do Not Honor"
		};

		for (int i = 0; i < respAndCodes.length; i++) {
			String respAndCode = respAndCodes[i];
			String code = respAndCode.substring(0,2);
			String response = respAndCode.substring(4);
		
			responses.put(code, response);
			
		}
		
		
		
	}
	
	public static String getResponse(String code){
		
		if(responses == null){
			buildResponses();
		}
		
		return responses.get(code);
	}
	
}
